﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace ChouteZemUp.Engine
{
    public class MovableGameObject : AnimatedGameObject
    {
		protected Vector2 mVelocity;
		protected Vector2 mDirection;
        protected float mSpeed;


        public MovableGameObject(Vector2 pDirection, float pSpeed, string pSpritePath, Vector2 pPositionInitiale, ContentManager pContent, Game pGame) : base(pSpritePath, pPositionInitiale, pContent, pGame)
        {
            mVelocity = Vector2.Zero;
            mDirection = pDirection;

            mSpeed = pSpeed;
        }

        public override void Update(GameTime pTime)
        {
            Vector2 lDir = mVelocity + mDirection;

            if(lDir.LengthSquared() != 0)
                lDir.Normalize();

            mPosition += lDir * mSpeed; //TODO DELTA TIME

            mVelocity = lDir;

            base.Update(pTime);
        }


    }
}
